<?php
/*! \brief
 * This is WFTypeFactory class
 * This is the Simple Factory Class that create relative Type Class
 * \author William Su
 */
class WFTypeFactory
{
    protected $objFramework;
    public function __construct($objFramework){
        $this->objFramework = $objFramework;
    }
    private static $instance;
    public static function getDirnameFile(){
        if(! isset(self::$instance[__FUNCTION__])){
            self::$instance[__FUNCTION__] = dirname(__FILE__);
        }
        return self::$instance[__FUNCTION__];
    }
    /**
     * @return WFString
     */
    public function getString(){
        if(! isset(self::$instance[__FUNCTION__])){
            require_once self::getDirnameFile() . '/String.php';
            self::$instance[__FUNCTION__] = new WFString();
        }
        return self::$instance[__FUNCTION__];
    }
    /**
     * @return WFObject
     */
    public function getObject(){
        if(! isset(self::$instance[__FUNCTION__])){
            require_once self::getDirnameFile() . '/Object.php';
            self::$instance[__FUNCTION__] = new WFObject($this->objFramework);
        }
        return self::$instance[__FUNCTION__];
    }
}